package com.itheima.test1;

public class MyFactoryDemo3 {
    public static void main(String[] args) {
        //求5的阶层
        int sum = getSum(5);
        System.out.println(sum);
    }

    private static int getSum(int i) {
            //1.出口:
        if(i == 1){
            return 1;
        }else{
            //2.递归规则:
            return i * getSum(i - 1);
        }
    }
}


